package org.eiahe.hr.attendance.domain.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.ehe.common.core.validate.AddGroup;
import org.ehe.common.core.validate.EditGroup;
import org.ehe.common.core.xss.Xss;
import org.ehe.common.mybatis.core.domain.BaseEntity;
import org.eiahe.hr.attendance.domain.LeaveApplication;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 请假申请业务对象 hr_leave_application
 *
 * @author zhangnn
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = LeaveApplication.class, reverseConvertGenerate = false)
public class LeaveApplicationBo extends BaseEntity {

    /**
     * 申请ID
     */
    @NotNull(message = "申请ID不能为空", groups = { EditGroup.class })
    private Long applicationId;

    /**
     * 工号
     */
    @NotBlank(message = "工号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String employeeNo;

    private String employeeName;

    /**
     * 用户ID
     */
    @NotNull(message = "用户ID不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long userId;

    /**
     * 请假类型(1事假 2病假 3年假 4调休 5婚假 6产假 7陪产假 8丧假)
     */
    @NotBlank(message = "请假类型不能为空", groups = { AddGroup.class, EditGroup.class })
    private String leaveType;

    /**
     * 开始时间
     */
    @NotNull(message = "开始时间不能为空", groups = { AddGroup.class, EditGroup.class })
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @NotNull(message = "结束时间不能为空", groups = { AddGroup.class, EditGroup.class })
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    /**
     * 请假天数
     */
    private BigDecimal leaveDays;

    /**
     * 请假事由
     */
    @Xss(message = "请假事由不能包含脚本字符")
    private String leaveReason;

    /**
     * 附件
     */
    private String attachment;

    /**
     * 审批状态(0待审批 1审批中 2已通过 3已拒绝)
     */
    private String approvalStatus;

    /**
     * 数据来源(LOCAL本地录入,OA系统同步)
     */
    private String source;

    /**
     * OA系统ID
     */
    private String oaId;

    /**
     * 状态(0正常 1停用)
     */
    private String status;

    /**
     * 备注
     */
    @Xss(message = "备注不能包含脚本字符")
    private String remark;
}
